package com.kaifamiao.www.ioDemo.do0922;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class FileWriterDemo {
    public static void main(String[] args) {
        /**
         * 字符缓存输出流
         */
        try (FileWriter fw = new FileWriter("E:\\kaifamiao\\workspace\\idea--space\\io\\filewriter.txt");
             BufferedWriter bw = new BufferedWriter(fw)
        ){
            bw.write("鹅鹅鹅");
            //newLine换行
            bw.newLine();
            bw.write("曲项向天歌");
            bw.newLine();
            bw.write("白毛浮绿水");
            bw.newLine();
            bw.write("红掌拨清波");
            bw.flush();
            System.out.println("输入完毕");
        } catch (IOException e) {
            System.out.println("写入文件出错");;
        }
    }
}
